<?php 

namespace Leads\Model\Entity;
class address
{
	protected $_id;
	protected $_city;
	protected $_country;
	protected $_invalid;
	protected $_latitude;
	protected $_longitude;
	protected $_postalcode;
	protected $_street1;
	protected $_street2;
	protected $_state;


	public function exchangeArray($data)
	{
		$this->_id= (isset($data['id'])) ? $data['id'] : null;
		$this->_city=(isset($data['city'])) ? $data['city'] : null;
		$this->_country=(isset($data['country'])) ? $data['country'] : null;
		$this->_invalid=(isset($data['invalid'])) ? $data['invalid'] : null;
		$this->_latitude=(isset($data['latitude'])) ? $data['latitude'] : null;
		$this->_longitude=(isset($data['longitude'])) ? $data['longitude'] : null;
		$this->_postalcode=(isset($data['postalcode'])) ? $data['postalcode'] : null;
		$this->_street1=(isset($data['street1'])) ? $data['street1'] : null;
		$this->_street2=(isset($data['street2'])) ? $data['street2'] : null;
		$this->_state=(isset($data['state'])) ? $data['state'] : null;
				
	}
	public function __construct(array $options = null) {
		if (is_array($options)) {
			$this->setOptions($options);
		}
	}
	
	public function __set($name, $value) {
		$method = 'set' . $name;
		if (!method_exists($this, $method)) {
			throw new Exception('Invalid Method');
		}
		$this->$method($value);
	}
	
	public function __get($name) {
		$method = 'get' . $name;
		if (!method_exists($this, $method)) {
			throw new Exception('Invalid Method');
		}
		return $this->$method();
	}
	
	public function setOptions(array $options) {
		$methods = get_class_methods($this);
		foreach ($options as $key => $value) {
			$method = 'set' . ucfirst($key);
			if (in_array($method, $methods)) {
				$this->$method($value);
			}
		}
		return $this;
	}
	
	public function getId() {
		return $this->_id;
	}
	public function setId($id) {
		$this->_id = $id;
		return $this;
	}
	

	public function getCity() {
		return $this->_city;
	}
	public function setCity($city) {
		$this->_city = $city;
		return $this;
	}
	
	public function getCountry() {
		return $this->_country;
	}
	public function setCountry($country) {
		$this->_country = $country;
		return $this;
	}
	
	public function getInvalid() {
		return $this->_invalid;
	}
	public function setInvalid($invalid) {
		$this->_invalid = $invalid;
		return $this;
	}
	
	public function getLatitude() {
		return $this->_latitude;
	}
	public function setLatitude($latitude) {
		$this->_latitude = $latitude;
		return $this;
	}
	
	public function getLongitude() {
		return $this->_longitude;
	}
	public function setLongitude($longitude) {
		$this->_longitude = $longitude;
		return $this;
	}
	
	public function getPostalCode() {
		return $this->_postalcode;
	}
	public function setPostalCode($postalcode) {
		$this->_postalcode = $postalcode;
		return $this;
	}
	
	public function getStreet1() {
		return $this->_street1;
	}
	public function setStreet1($street1) {
		$this->_street1 = $street1;
		return $this;
	}
	
	public function getStreet2() {
		return $this->_street2;
	}
	public function setStreet2($street2) {
		$this->_street2 = $street2;
		return $this;
	}
	
	public function getState() {
		return $this->_state;
	}
	public function setState($state) {
		$this->_state = $state;
		return $this;
	}
}

?>